﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Web.Http;
using System.Web.Http.Description;
using System.Web.UI.WebControls;
using DBSystem.BussinesEntities;
using DBSystem.BussinesLogic;
using Microsoft.Practices.Unity;

namespace DBSystem.Api.Controllers
{
    public class CategoriaController : ApiController
    {
        [Dependency]
        public ICategoriaService CategoriaService { get; set; }

        public IEnumerable<Categoria> Get()
        {
            return CategoriaService.GetCategorias();
        }

        [ResponseType(typeof(Categoria))]
        public IHttpActionResult Post(Categoria categoria)
        {
            CategoriaService.AddCategoria(categoria);

            return CreatedAtRoute("DefaultApi", new { id = categoria.id}, categoria);
        }


    }
}
